package com.cssl.service.impl;

import com.cssl.domain.DtsIssue;
import com.cssl.domain.dto.DtsissueDto;
import com.cssl.mapper.DtsissueMapper;
import com.cssl.service.Dtsissueservice;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class DtsissueserviceImpl implements Dtsissueservice {

    @Autowired
    private DtsissueMapper mapper;


    @Override
    public Map findPageissue(DtsissueDto dtsissueDto) {
        System.out.println("传入" +dtsissueDto);
        Page page = PageHelper.startPage(dtsissueDto.getPage(),dtsissueDto.getLimit());

        List<DtsIssue> issues=mapper.findPageissue(dtsissueDto);
        System.out.println("查询结果: " + issues); // 打印查询结果
        System.out.println("分页结果: " + page.getResult()); // 打印分页结果
        Map map = new HashMap();
        map.put("list", page.getResult());
        map.put("total", page.getTotal());
        map.put("totalPage", page.getPages());
        map.put("pageNum", page.getPageNum());
        map.put("pageSize", page.getPageSize());
        return map;
    }
    @Override
    public boolean issuedelete(String ids) {
        return mapper.issuedelete(ids);
    }

    @Override
    public Integer updateissue(Map map) {
        return  mapper.updateissue(map);
    }

    @Override
    public Integer issuebrand(Map map) {
        return mapper.addissue(map);
    }
}
